#ifndef COMPLETER_DELEGATE_H
#define COMPLETER_DELEGATE_H

#include <QtGui/QStyledItemDelegate>

QT_BEGIN_NAMESPACE
class QCompleter;
class QStandardItemModel;
QT_END_NAMESPACE

namespace gui
{
class PropertyEditor;

class CompleterDelegate : public QStyledItemDelegate
{
    Q_OBJECT

public:
    CompleterDelegate(PropertyEditor* parent);
    ~CompleterDelegate();

    // QStyledItemDelegate
    QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option,
        const QModelIndex& index) const;

    void setEditorData(QWidget* editor, const QModelIndex& index) const;
    void setModelData(QWidget* editor, QAbstractItemModel* model,
        const QModelIndex& index) const;

    void updateEditorGeometry(QWidget* editor,
        const QStyleOptionViewItem& option,
        const QModelIndex& index) const;

private:
    PropertyEditor* m_parent;
    QCompleter* m_completer;
    QStandardItemModel* m_completitionModel;
};

} // namespace gui

#endif
